package dao;

import com.lagou.RunBoot;
import com.lagou.entity.COrder;
import com.lagou.repository.COrderRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest(classes= RunBoot.class)
public class test_masterslave {

    @Resource
    private COrderRepository cOrderRepository;

    @Test
    public void testAdd(){
        COrder cOrder = new COrder();
        //cOrder.setId(i);
        cOrder.setDel(false);
        cOrder.setUserId(11);
        cOrder.setCompanyId(12);
        cOrder.setPublishUserId(13);
        cOrder.setPositionId(1);
        cOrder.setResumeType(0);
        cOrder.setStatus("1");
        cOrder.setCreateTime(new Date());
        cOrder.setUpdateTime(new Date());
        cOrderRepository.save(cOrder);
    }

    @Test
    public void testQuery(){
        List<COrder> list = cOrderRepository.findAll();
        list.forEach(cOrder->{
            System.out.println(cOrder.toString());
        });
    }
}
